import {readFileSync} from 'fs';
import {join} from 'path';

const DELAY = 200;

export default async function (ctx, next) {
    let {req, res} = ctx;

    switch (req.url) {
        case '/api/users':
            let json = JSON.parse(readFileSync(join(__dirname, '../mock/user.json'), 'utf-8'));
            ctx.response.body = json;
            break;
        default:
            await next();
            break;
    }
}
